﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;
using YT.Commons;

using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.IO;


namespace YT.XH.IgE.Reports
{
    public partial class frmPrintView : YT.AdvanceCommons.frmPrintView
    {
        public frmPrintView()
        {
            InitializeComponent();

            this.GetReportViewer += new OnGetReportViewer(Get_ReportViewer);
            this.GetLocalReport += new OnGetLocalReport(Get_LocalReport);


        }

        private ReportViewer Get_ReportViewer(ReportDataSource reportDataSource, string strRptName, ReportParameter[] rptParaArray)
        {

            rptView.LocalReport.ReportEmbeddedResource = strRptName;
            rptView.LocalReport.DataSources.Add(reportDataSource);
            if (rptParaArray != null) rptView.LocalReport.SetParameters(rptParaArray);

            return this.rptView;
        }

        private LocalReport Get_LocalReport(ReportDataSource reportDataSource, string strRptName, ReportParameter[] rptParaArray)
        {
            LocalReport report = new LocalReport();
            report.ReportEmbeddedResource = strRptName;
            report.DataSources.Add(reportDataSource);
            if (rptParaArray != null) report.SetParameters(rptParaArray);

            return report;
        }
    }
}
